package com.hr;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

import org.hibernate.annotations.Index;
import org.hibernate.annotations.Table;

import com.espirit.eap.sa.Employee;
import com.espirit.finance.core.AcctTerm;
import com.espirit.finance.core.AcctTermCheckAware;
import com.googlecode.cswish.model.Saas;

@Entity
@Table(indexes={
		@Index(name="idx_parentemployeedutyon", columnNames={"parent_id","employee_id","dutyon"} )},appliesTo = "hr_schedualrecord")
public class SchedualRecord implements Serializable, AcctTermCheckAware, Saas{
	private static final long serialVersionUID = 3699562187588916835L;

	private Integer id;
	private Integer sid;
	public Integer getSid() {
		return sid;
	}

	public void setSid(Integer sid) {
		this.sid = sid;
	}
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	
	@ManyToOne
	public Schedual getParent() {
		return parent;
	}
	public void setParent(Schedual parent) {
		this.parent = parent;
	}

	@ManyToOne
	public Employee getEmployee() {
		return employee;
	}
	public void setEmployee(Employee employee) {
		this.employee = employee;
	}


	public String getScope() {
		return scope;
	}
	public void setScope(String scope) {
		this.scope = scope;
	}


	public Date getDutyOn() {
		return dutyOn;
	}
	public void setDutyOn(Date dutyOn) {
		this.dutyOn = dutyOn;
	}


	private Employee employee;
	private Schedual parent;
	private Date dutyOn;
	private String scope;

	@Override
	public boolean check(AcctTerm acctTerm) {
		if (parent != null){
			return parent.check(acctTerm);
		}
		return true;
	}
}
